<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
只要你打开控制台我就能检测到。
<h1 id="mes" style="color: red;"></h1>
<script>
    let startTime;
    const time = 50,
        mes = document.getElementById('mes');
    setInterval(() => {
        startTime = new Date();
        debugger;
        new Date() - startTime > 50 && (mes.innerText = '检测到你打开了浏览器控制台!');
    }, 500);
</script>
</body>
</html>